package com.waimai.mobile.ui.fragment;

import android.support.v4.app.Fragment;
import android.widget.ListView;
import android.widget.RatingBar;
import android.widget.TextView;

import com.waimai.mobile.R;
import com.waimai.mobile.api.entity.Restaurant;
import com.waimai.mobile.ui.activity.RestaurantActivity;
import com.waimai.mobile.ui.adapter.CommentItemAdpater;

import org.androidannotations.annotations.AfterInject;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.ViewById;

/**
 * Created by lin on 2015/5/29.
 */

@EFragment(R.layout.fragment_restaurant_detail)
public class RestaurantDetailFragment extends Fragment {

    public Restaurant restaurant;

    @ViewById
    public TextView restaurantNameTv;

    @ViewById
    public RatingBar starLevelArgRb;

    @ViewById
    public TextView starLevelArgTv;

    @ViewById
    public TextView noticeTv;

    @ViewById
    public TextView deliveryTimeArgTv;

    @ViewById
    public TextView sendPriceTv;

    @ViewById
    public TextView deliveryPriceTv;

    @ViewById
    public TextView businessTimeTv;

    @ViewById
    public TextView addressTv;

    @AfterInject
    public void afterInject(){
        restaurant = ((RestaurantActivity)getActivity()).restaurant;
    }

    @AfterViews
    public void afterViews(){
        restaurantNameTv.setText(restaurant.getRestaurantName());
        starLevelArgRb.setRating(restaurant.getStarLevelArg());
        starLevelArgTv.setText(restaurant.getStarLevelArg()+"");

        if(restaurant.getNotice() == null || "".equals(restaurant.getNotice())){
            noticeTv.setText("暂无通知");
        }else {
            noticeTv.setText(restaurant.getNotice());
        }

        deliveryTimeArgTv.setText(restaurant.getDeliveryTimeArg()+"");
        sendPriceTv.setText(restaurant.getSendPrice()+"");
        deliveryPriceTv.setText(restaurant.getDeliveryPrice()+"");
        businessTimeTv.setText(restaurant.getBusinessTime());
        addressTv.setText(restaurant.getAddress());
    }

}